-
Notifications
You must be signed in to change notification settings - Fork 3k
Use equals() instead of Ref. equality #2716
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| PartitionSpec spec = SparkSchemaUtil.specForTable(spark, sourceTableIdentWithDB.unquotedString()); | ||
|
|
||
| if (spec == PartitionSpec.unpartitioned()) { | ||
| if (Objects.equal(spec, PartitionSpec.unpartitioned())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
checking for ref. equality is probably fine here, but it takes a reader longer to navigate the code and figure out whether ref equality is really wanted here vs just using equals()
| } | ||
|
|
||
| @Override | ||
| @SuppressWarnings("ReferenceEquality") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is for the boolean isRoot = root == rowType check, which seems to be on purpose, but maybe you could double check whether using ref. equality here is still wanted? Same for SparkTypeToType
db6c75d to
2c080c9
Compare
| */ | ||
| public boolean satisfies(SortField other) { | ||
| if (this == other) { | ||
| if (Objects.equals(this, other)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
even though using Ref equlity is correct here, it just takes the reader much longer to verify whether it's the intention or not than just using equals() here
2c080c9 to
65074bc
Compare
@rdblue looks like I missed a few places in #2714 because Gradle was caching some stuff and therefore didn't recompile & re-run ErrorProne. Turns out one has to delete
~/.gradle/caches/build-cache-1before running./gradlew build -x test -x javadoc -x integrationTestlocally in order to see all ErrorProne warnings, as otherwise you only get the results for the projects that were re-compiled.